package com.hand.qt24953.order.constant;

/**
 * 订单状态
 *
 * @author qiutao 2019/8/6 15:59
 */
public enum OrderStatus {
    /**
     * 新建
     */
    NEW("新建"),
    /**
     * 已提交
     */
    SUBMITED("已提交"),
    /**
     * 已审批
     */
    APPROVED("已审批"),
    /**
     * 已拒绝
     */
    REJECTED("已拒绝"),
    /**
     * 已关闭
     */
    CLOSED("已关闭");

    private String meaning;

    OrderStatus(String meaning) {
        this.meaning = meaning;
    }

    public String getMeaning() {
        return meaning;
    }

    public void setMeaning(String meaning) {
        this.meaning = meaning;
    }

    /**
     * 将汉字转为状态
     *
     * @param status 汉字
     * @return
     */
    public static OrderStatus parse(String status) {
        switch (status) {
            case "新建":
                return NEW;
            case "已提交":
                return SUBMITED;
            case "已审批":
                return APPROVED;
            case "已拒绝":
                return REJECTED;
            case "已关闭":
                return CLOSED;
            default:
                return null;
        }
    }


}
